package com.todo.event.activity.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/1/7 09:40
 * @description
 */
@AllArgsConstructor
@Getter
public enum EventActivityStatusEnum {

    DRAFT(1, "DRAFT", "草稿"),
    AUDIT_SUCCESS(2, "AUDIT_SUCCESS", "审核成功"),
    RUNNING(3, "RUNNING", "已上线"),
    SHUTDOWN(4, "SHUTDOWN", "已停止"),
    EXPIRED(5, "EXPIRED", "已过期"),
    ;

    private static Map<Integer, EventActivityStatusEnum> typeMap = Arrays
            .stream(EventActivityStatusEnum.values())
            .collect(Collectors.toMap(EventActivityStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static EventActivityStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
